#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <string>
#include <windows.h>
#include <dir.h>

using namespace std;

int main()
{
	string name;
	cerr << "Input the problem name :" << endl;
	getline(cin, name);
	mkdir(name.c_str());
	freopen((name + "//" + name + ".cpp").c_str(),  "w", stdout);
	
	cout << "#include <iostream>" << endl;
	cout << "#include <cstdio>" << endl;
	cout << "#include <cstring>" << endl;
	cout << "#include <string>" << endl;
	cout << endl;
	cout << "using namespace std;" << endl;
	cout << endl;
	cout << "int main()" << endl;
	cout << "{\n\treturn 0;\n}" << endl;

	fclose(stdout);
	freopen((name + "//" + "data.in").c_str(),  "w", stdout);
	fclose(stdout);
	freopen((name + "//" + "data.out").c_str(),  "w", stdout);
	fclose(stdout);
	freopen((name + "//" + "test.bat").c_str(),  "w", stdout);
	cout << "echo off" << endl;
	cout << "cls" << endl;

	cout << "g++ ";
	cout << '"' + name + ".cpp";
	cout << '"';
	cout << " -o ";
	cout << '"' + name + '"' << endl;

	cout << '"' + name + ".exe";
	cout << '"';
	cout << " < data.in > out" << endl;
	
	cout << "fc out data.out" << endl; 
	cout << "pause" << endl;
	fclose(stdout);
	return 0;
}
